-- seckill
-- Created by chengb Mar/24/2016
-- 道具：放逐（秒杀敌人，对Boss无效）

return {
    apply = function(source, target, classId, value)
        -- 概率判断
        local seed = DungeonM.getRandSeed("seckill");
        if seed % 1000 >= value then
            return;
        end

        -- 传入攻击者信息
        local assailantInfo = {
            ["property_id"] = classId,
        };

        local damage = target:getHp();
        if target:isBoss() then
            -- 对boss无效
            damage = 0;
        end

        -- 修正伤害值
        damage = PropertyM.fixPropertyDamage(source, target, classId, damage);

        CombatM.doDamage(source, target, damage, 0, false, { assailantInfo = assailantInfo, seckill = true,});

        -- 抛出使用异域的灯芯事件
        if target.type == OBJECT_TYPE_MONSTER then
            EventMgr.fire(event.USE_ALLOPATRIC_WICK, { ["pos"] = target:getPos(), });
        end
    end,
};
